package Client.geass.gui.loginGUI;


import Client.geass.gui.guiController.ClientUserController;
import Client.geass.gui.guiController.ClientUserControllerInterface;
import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author Kite
 */
public class LoginJFrame extends javax.swing.JFrame {

    private LoginJPanel loginPanel ;
    private RegisterJPanel registerPanel ;
    private LoadingJPanel loadingPanel ;
    private ClientUserControllerInterface clientUserController;
    
    public LoginJFrame() {
        initComponents();
        innitial();
    }
    
    
    private void innitial(){
        Toolkit kit = Toolkit.getDefaultToolkit();
        Dimension screenSize=kit.getScreenSize();
        this.setLocation((screenSize.width-this.getWidth())/2, (screenSize.height-this.getHeight())/2);
        clientUserController = new ClientUserController();
        loginPanel = new LoginJPanel(this,clientUserController);
        registerPanel = new RegisterJPanel(this,clientUserController);
        //loadingPanel = new LoadingJPanel(this);
        this.setContentPane(loginPanel);
        this.validate();
        
    }
    
    
    public void switchToRegister(){
        this.setContentPane(registerPanel);
        this.validate();
    }
    
    public void switchToLogin(){
        this.setContentPane(loginPanel);
        this.validate();
    }
    
    public void switchToLoading(){
        
        
    }
    
   
    public void destroy(){
        this.dispose();
        System.exit(0);
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 250, Short.MAX_VALUE)
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
